package wish.regularExpression;

import java.util.List;

public abstract class RegularExpressionElement {

	public abstract boolean matches(RegularExpressionElement regExpele);

	public abstract List<RegularExpressionElement> getMachingElements();
	
	public boolean equals(Object o){
		return this.toString().equals(o.toString());
	}
	
	public boolean isMultipleMatch(){
		return false;
	}
	
	public RegularExpressionElement expand(RegularExpressionElement regExp){
		if (matches(regExp)){
			return expandWithMatchingRegularExpression(regExp);
		}
		return this;
	}

	protected abstract RegularExpressionElement expandWithMatchingRegularExpression(
			RegularExpressionElement regExp);
	
}
